package cn.zcy.springboot_mybatis.service.impl;

import cn.zcy.springboot_mybatis.domain.Emp;
import cn.zcy.springboot_mybatis.mapper.EmpMapper;
import cn.zcy.springboot_mybatis.service.IEmpService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmpServiceImpl implements IEmpService {
    Logger logger= LoggerFactory.getLogger(EmpServiceImpl.class);
    @Autowired
    private EmpMapper empMapper;
    @Override
    public PageInfo<Emp> selectEmpList(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        logger.info("分页参数：pageNum="+pageNum);
        logger.info("分页参数：pageSize="+pageSize);
        List<Emp> emps = empMapper.selectAll();
          logger.info("emps="+emps);
        PageInfo pageInfo=new PageInfo();
        pageInfo.setList(emps);
        return pageInfo;
    }
}
